import * as echarts from 'echarts'

// ECharts主题配置
export const chartTheme = {
  color: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc']
}

// 初始化图表
export function initChart(dom, theme = 'default') {
  const chart = echarts.init(dom, theme)
  return chart
}

// 通用图表配置
export const commonOptions = {
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  }
}